<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>轩正企业人事管理系统 - 系统管理员主页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/home.css">
    <link rel="stylesheet" href="css/watermark.css">
    <link rel="stylesheet" href="css/admin.css">
    <link rel="stylesheet" href="css/ai-chat.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>
<body>
    <div class="container">
        <div class="header header-admin">
            <h1>轩正企业人事管理系统 - 系统管理员</h1>
            <div class="user-info">
                <span id="user-name">加载中...</span>
                <span id="user-id">ID: 加载中...</span>
                <a href="logout">退出登录</a>
            </div>
        </div>
        
        <div class="welcome-container">
            <div class="welcome-message">欢迎回来，尊敬的系统管理员！</div>
            <button id="refresh-btn" class="refresh-btn"><i class="fas fa-sync-alt"></i> 刷新</button>
        </div>
        
        <div class="main-content">
            <!-- 左侧二级菜单 -->
            <div class="submenu">
                <div class="submenu-item">
                    <a href="#" class="active" data-target="system-applications">查看系统使用申请</a>
                    <span class="notification-count" id="notification-system-applications"></span>
                </div>
                <div class="submenu-item">
                    <a href="#" data-target="find-company">查找公司</a>
                </div>
                <div class="submenu-item">
                    <a href="#" data-target="find-user">查找用户</a>
                </div>
                <div class="submenu-item">
                    <a href="#" data-target="ai-settings">AI设置</a>
                </div>
                <div class="submenu-item">
                    <a href="#" data-target="change-password">修改密码</a>
                </div>
            </div>
            
            <!-- 右侧内容区域 -->
            <div class="content-area">
                <div id="system-applications" class="function-content active">
                    <h2>查看系统使用申请</h2>
                    
                    <!-- 搜索和筛选区域 -->
                    <div class="search-filters">
                        <select id="status-filter">
                            <option value="">所有状态</option>
                            <option value="0">待审核</option>
                            <option value="1">已通过</option>
                            <option value="2">已拒绝</option>
                        </select>
                        <input type="text" id="keyword-search" placeholder="搜索姓名/电话/ID">
                        <button id="search-btn">搜索</button>
                    </div>
                    
                    <!-- 申请列表区域 -->
                    <div id="applications-list">
                        <!-- 这里将显示申请列表 -->
                    </div>
                    
                    <!-- 分页区域 -->
                    <div id="pagination" class="pagination">
                        <!-- 这里将显示分页控件 -->
                    </div>
                </div>
                <div id="find-company" class="function-content">
                    <h2>查找公司</h2>
                    
                    <!-- 搜索和筛选区域 -->
                    <div class="search-filters">
                        <select id="company-search-type">
                            <option value="all">所有公司</option>
                            <option value="id">公司ID</option>
                            <option value="manager">负责人姓名</option>
                            <option value="creditCode">统一社会信用代码</option>
                        </select>
                        <input type="text" id="company-keyword" placeholder="请输入搜索关键词">
                        <button id="company-search-btn">搜索</button>
                    </div>
                    
                    <!-- 公司列表区域 -->
                    <div id="companies-list">
                        <!-- 这里将显示公司列表 -->
                    </div>
                    
                    <!-- 分页区域 -->
                    <div id="company-pagination" class="pagination">
                        <!-- 这里将显示分页控件 -->
                    </div>
                </div>
                <div id="find-user" class="function-content">
                    <h2>查找用户</h2>
                    
                    <!-- 搜索和筛选区域 -->
                    <div class="search-filters">
                        <select id="user-search-type">
                            <option value="name">用户姓名</option>
                            <option value="phone">手机号</option>
                            <option value="idCard">身份证号</option>
                        </select>
                        <input type="text" id="user-keyword" placeholder="请输入搜索关键词">
                        <button id="user-search-btn">搜索</button>
                    </div>
                    
                    <!-- 用户列表区域 -->
                    <div id="users-list">
                        <!-- 这里将显示用户列表 -->
                    </div>
                    
                    <!-- 分页区域 -->
                    <div id="users-pagination" class="pagination">
                        <!-- 这里将显示分页控件 -->
                    </div>
                </div>
                <div id="change-password" class="function-content">
                    <h2>修改密码</h2>
                    <div class="form-container">
                        <form id="change-password-form">
                            <div class="form-group">
                                <label for="old-password">当前密码：</label>
                                <input type="password" id="old-password" name="oldPassword" required>
                                <div class="password-requirements"></div>
                            </div>
                            <div class="form-group">
                                <label for="new-password">新密码：</label>
                                <input type="password" id="new-password" name="newPassword" required>
                                <div class="password-requirements">
                                    <p>密码要求：</p>
                                    <ul>
                                        <li>长度不少于6位</li>
                                    </ul>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="confirm-password">确认新密码：</label>
                                <input type="password" id="confirm-password" name="confirmPassword" required>
                                <div class="password-requirements"></div>
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary">修改密码</button>
                            </div>
                        </form>
                    </div>
                </div>
                <div id="ai-settings" class="function-content">
                    <h2>AI设置</h2>
                    <div class="ai-settings-container">
                        <div class="ai-models-section">
                            <h3>AI模型管理</h3>
                            <div class="action-buttons">
                                <button id="add-model-btn" class="btn btn-primary"><i class="fas fa-plus"></i> 添加模型</button>
                                <button id="refresh-models-btn" class="btn btn-secondary"><i class="fas fa-sync-alt"></i> 刷新</button>
                            </div>
                            <div id="ai-models-list" class="models-list">
                                <div class="loading">加载中...</div>
                            </div>
                        </div>
                        
                        <div class="ai-limits-section">
                            <h3>用户限制设置</h3>
                            <div class="limit-settings">
                                <div class="form-group">
                                    <label for="default-daily-limit">默认每日提问次数:</label>
                                    <input type="number" id="default-daily-limit" min="1" max="100" value="10">
                                    <button id="update-default-limit-btn" class="btn btn-primary">更新</button>
                                </div>
                                <!--废案，用来限制单个用户使用ai，没必要，直接锁用户就行-->
<!--
                                <div class="form-group">
                                    <label>用户搜索与设置:</label>
                                    <button id="search-user-btn" class="btn btn-secondary"><i class="fas fa-search"></i> 搜索用户</button>
                                </div>  
-->
                            </div>
                        </div>
                        
                        <div class="ai-system-section">
                            <h3>系统设置</h3>
                            <div class="system-settings">
                                <div class="form-group">
                                    <label for="ai-enabled">AI功能启用:</label>
                                    <select id="ai-enabled">
                                        <option value="1">启用</option>
                                        <option value="0">禁用</option>
                                    </select>
                                    <button id="update-ai-enabled-btn" class="btn btn-primary">更新</button>
                                </div>
                                <div class="form-group">
                                    <label for="default-model-select">默认模型:</label>
                                    <select id="default-model-select">
                                        <!-- 模型选项将动态加载 -->
                                    </select>
                                    <button id="update-default-model-btn" class="btn btn-primary">更新</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 审核申请模态框（保留但隐藏，以免JS报错） -->
    <div id="review-modal" class="modal" style="display:none">
        <div class="modal-content">
            <div class="modal-header">
                <span class="modal-close">&times;</span>
                <h3 id="review-modal-title">审核申请</h3>
            </div>
            <div class="modal-body">
                <form id="review-form" class="modal-form">
                    <input type="hidden" id="application-id">
                    <input type="hidden" id="review-action">
                    <div id="reject-reason-container">
                        <label for="reject-reason">拒绝原因：</label>
                        <textarea id="reject-reason" rows="4" placeholder="请输入拒绝申请的原因..."></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="cancel" id="review-cancel">取消</button>
                <button class="submit" id="review-submit">提交</button>
            </div>
        </div>
    </div>
    
    <!-- 查看申请详情模态框 -->
    <div id="details-modal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <span class="modal-close">&times;</span>
                <h3>申请详情</h3>
            </div>
            <div class="modal-body">
                <dl id="application-details" class="application-details">
                    <!-- 申请详情将在这里显示 -->
                </dl>
            </div>
            <div class="modal-footer">
                <button class="cancel" id="details-close">关闭</button>
            </div>
        </div>
    </div>
    
    <!-- 公司详情模态框 -->
    <div id="company-details-modal" class="modal">
        <div class="modal-content modal-content-wide">
            <div class="modal-header">
                <span class="modal-close">&times;</span>
                <h3>公司详情</h3>
            </div>
            <div class="modal-body">
                <div class="company-detail-container">
                    <div class="company-basic-info">
                        <h4>基本信息</h4>
                        <dl id="company-basic-details" class="detail-list">
                        </dl>
                    </div>
                    <div class="company-manager-info">
                        <h4>负责人信息</h4>
                        <dl id="company-manager-details" class="detail-list">
                        </dl>
                    </div>
                    <div class="company-employee-info">
                        <h4>员工信息摘要</h4>
                        <div id="company-employee-summary" class="employee-summary">
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="danger" id="company-status-btn">禁用公司</button>
                <button class="cancel" id="company-details-close">关闭</button>
            </div>
        </div>
    </div>
    
    <!-- 用户详情模态框 -->
    <div id="user-details-modal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <span class="modal-close">&times;</span>
                <h3>用户详情</h3>
            </div>
            <div class="modal-body">
                <dl class="detail-list" id="user-details">
                </dl>
            </div>
            <div class="modal-footer">
                <button class="danger" id="user-status-btn">禁用用户</button>
                <button class="danger" id="user-delete-btn">注销用户</button>
                <button class="cancel" id="user-details-close">关闭</button>
            </div>
        </div>
    </div>

    <!-- AI聊天弹窗按钮 -->
    <div id="ai-chat-fab" class="ai-chat-fab">
        <i class="fas fa-robot"></i>
        <span class="fab-text">AI</span>
    </div>

 <!-- AI聊天弹窗 -->
  <div id="ai-chat-modal" class="modal ai-chat-modal">
      <div class="modal-content ai-chat-content">
          <div class="modal-header ai-chat-header">
              <h3><i class="fas fa-robot"></i> AI助手</h3>
              <span class="modal-close ai-chat-close">&times;</span>
          </div>
          <div class="modal-body ai-chat-body">
              <div id="ai-chat-messages" class="ai-chat-messages">
                  <div class="ai-message">
                      <div class="message-content">
                          <i class="fas fa-robot"></i>
                          <span>你好！我是AI助手，有什么可以帮助您的吗？</span>
                      </div>
                  </div>
              </div>
              <div class="ai-chat-input-area">
                  <div class="ai-chat-info">
                      <span id="ai-usage-info">今日剩余提问次数: 加载中...</span>
                      <!-- 模型选择器 -->
                      <div class="ai-model-selector">
                          <label for="ai-model-select">选择模型:</label>
                          <select id="ai-model-select">
                              <!-- 模型动态加载 -->
                          </select>
                      </div>
                  </div>
                  <div class="ai-chat-input-container">
                      <textarea id="ai-chat-input" placeholder="请输入您的问题..." rows="3"></textarea>
                      <button id="ai-chat-send" class="ai-send-btn">
                          <i class="fas fa-paper-plane"></i>
                          发送
                      </button>
                  </div>
              </div>
          </div>
      </div>
  </div>

    <script src="js/home.js"></script>
    <script src="js/admin_home.js"></script>
    <script src="js/watermark.js"></script>
    <script src="js/ai-chat.js"></script>
    <script src="js/notification-manager.js"></script>
</body>
</html> 